package com.pth.admin.action;

import com.opensymphony.xwork2.ActionSupport;
import com.pth.model.Knowledge;
import com.pth.service.KnowledgeService;
import com.pth.utils.timeUtil;

public class AddKnowledgeAction extends ActionSupport {

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;
	private KnowledgeService knowledgeService;
	private Knowledge knowledge;

	public void setKnowledgeService(KnowledgeService knowledgeService) {
		this.knowledgeService = knowledgeService;
	}

	public KnowledgeService getKnowledgeService() {
		return knowledgeService;
	}

	public void setKnowledge(Knowledge knowledge) {
		this.knowledge = knowledge;
	}

	public Knowledge getKnowledge() {
		return knowledge;
	}
	
	
	@Override
	public String execute() throws Exception {

		knowledge.setPublishtime(timeUtil.getCurrentDate());
		knowledge.setScannum(0);
		knowledgeService.add(knowledge);
		return SUCCESS;
	}
	
}
